<?php

/**
 * ParticipantVersion filter form base class.
 *
 * @package    BuLaBuSys2013
 * @subpackage filter
 * @author     Maximilian Lenkeit
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BaseParticipantVersionFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'first_name'       => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'last_name'        => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'gender'           => new sfWidgetFormChoice(array('choices' => array('' => '', 'm' => 'm', 'f' => 'f'))),
      'date_of_birth'    => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'vegetarian'       => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'chapter'          => new sfWidgetFormFilterInput(),
      'age_group'        => new sfWidgetFormChoice(array('choices' => array('' => '', 'b' => 'b', 'w' => 'w', 'p' => 'p', 'r' => 'r', 'm' => 'm'))),
      'accomodation'     => new sfWidgetFormChoice(array('choices' => array('' => '', 't' => 't', 'h' => 'h'))),
      'booking_id'       => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'price_scaling_id' => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'created_at'       => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'updated_at'       => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'deleted_at'       => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'created_by'       => new sfWidgetFormFilterInput(),
      'updated_by'       => new sfWidgetFormFilterInput(),
      'deleted_by'       => new sfWidgetFormFilterInput(),
    ));

    $this->setValidators(array(
      'first_name'       => new sfValidatorPass(array('required' => false)),
      'last_name'        => new sfValidatorPass(array('required' => false)),
      'gender'           => new sfValidatorChoice(array('required' => false, 'choices' => array('m' => 'm', 'f' => 'f'))),
      'date_of_birth'    => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'vegetarian'       => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'chapter'          => new sfValidatorPass(array('required' => false)),
      'age_group'        => new sfValidatorChoice(array('required' => false, 'choices' => array('b' => 'b', 'w' => 'w', 'p' => 'p', 'r' => 'r', 'm' => 'm'))),
      'accomodation'     => new sfValidatorChoice(array('required' => false, 'choices' => array('t' => 't', 'h' => 'h'))),
      'booking_id'       => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'price_scaling_id' => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'created_at'       => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'updated_at'       => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'deleted_at'       => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'created_by'       => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'updated_by'       => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'deleted_by'       => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
    ));

    $this->widgetSchema->setNameFormat('participant_version_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'ParticipantVersion';
  }

  public function getFields()
  {
    return array(
      'id'               => 'Number',
      'first_name'       => 'Text',
      'last_name'        => 'Text',
      'gender'           => 'Enum',
      'date_of_birth'    => 'Date',
      'vegetarian'       => 'Boolean',
      'chapter'          => 'Text',
      'age_group'        => 'Enum',
      'accomodation'     => 'Enum',
      'booking_id'       => 'Number',
      'price_scaling_id' => 'Number',
      'created_at'       => 'Date',
      'updated_at'       => 'Date',
      'deleted_at'       => 'Date',
      'created_by'       => 'Number',
      'updated_by'       => 'Number',
      'deleted_by'       => 'Number',
      'version'          => 'Number',
    );
  }
}
